package com.dgut.autoconfig;

import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ApplicationEventMulticaster;
import org.springframework.context.event.SimpleApplicationEventMulticaster;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

@Configuration
@EnableConfigurationProperties(CustomProperties.class)
@ConditionalOnProperty(prefix = "sai.auto",name = "enable",havingValue = "true")
public class AutoConfig {

    @Bean
    public RemoteCommandLineRunner rcr(){
        return new RemoteCommandLineRunner();
    }

    @Bean
    public ApplicationListener<ApplicationReadyEvent> listener(){
        return new ApplicationListener<ApplicationReadyEvent>() {
            @Override
            public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
                System.out.println("自定义 ApplicationReadyEvent 事件监听器 ! ");
            }
        };
    }


}
